package com.hc.service.impl;

import com.hc.bean.ShopCart;
import com.hc.dao.ShopCartDao;
import com.hc.service.ShopCartService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class ShopCartServiceImpl implements ShopCartService {
    @Resource
    private ShopCartDao shopCartDao;
    @Override
    public Boolean addShopCart(ShopCart shopCart) {
        if(shopCartDao.addShopCart(shopCart)>0)
            return true;
        return false;
    }

    @Override
    public Boolean updateShopCart(ShopCart shopCart) {
        if (shopCartDao.updateShopCart(shopCart)>0)
            return true;
        return false;
    }

    @Override
    public Boolean deleteShopCart(String shopCartIds) {
        if(shopCartDao.deleteShopCart(shopCartIds)>0)
            return true;
        return false;
    }

    @Override
    public ShopCart getShopCartByPid(Integer userId,Integer pid) {
        return shopCartDao.getShopCartByPid(userId,pid);
    }

    @Override
    public List<ShopCart> getShopCartByUid(Integer uid) {
        return shopCartDao.getShopCartByUid(uid);
    }
}
